package com.simplegovern.authority.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.simpleframe.persistence.hibernate.Page;
import com.simpleframe.persistence.hibernate.Searcher;
import com.simplegovern.authority.SysGroup;
import com.simplegovern.authority.dao.GroupDAO;

public class GroupService {

	@Autowired
	private GroupDAO groupDAO;
	
	public List<SysGroup> getGroups(){
		return groupDAO.loadAll();
	}
	
	public SysGroup getById(long id){
		return groupDAO.findById(id);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void deletes(Long[] ids){
		groupDAO.deletes(ids);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void create(SysGroup group){
		groupDAO.save(group);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void update(SysGroup group){
		groupDAO.update(group);
	}
	
	//以上自动生成
	
	public Page getPage(Searcher searcher){
		return groupDAO.getPage(searcher);
	}

}
